﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Threading;
using System.IO;
using System.Text.RegularExpressions;
using Telerik.Windows.Controls;
using InfoPick.UI.Views;
using InfoPick.UI.Comm;

namespace InfoPick.UI
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            this.initMenu();
            this.itemList.SelectedIndex = 0;
        }

        public void initMenu()
        {
            List<SysNode> nodes = new List<SysNode>();
            //初始化菜单项
            //首页
            //nodes.Add(new SysNode() { Title = "系统首页", Path = "Index", IsSelected = true, IconPath = "../Theme/Images/macosxstyle_020.png" });

            nodes.Add(new SysNode() { Title = "消息转换", Path = "TrackInfo", IconPath = "../Theme/Images/macosxstyle_046.png" });
            nodes.Add(new SysNode() { Title = "资料获取", Path = "InfoPickPage", IconPath = "../Theme/Images/macosxstyle_041.png" });
            nodes.Add(new SysNode() { Title = "系统设置", Path = "SystemPage", IconPath = "../Theme/Images/macosxstyle_038.png" });


            itemList.ItemsSource = nodes;
        }
        private void itemList_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (e.AddedItems != null && e.AddedItems.Count > 0)
            {
                SysNode item = e.AddedItems[0] as SysNode;
                if (item.Path != null && !string.IsNullOrEmpty(item.Path.ToString()))
                {
                    ContentFrame.Source = new Uri("Views/" + item.Path + ".xaml", UriKind.Relative);
                }
            }
        }


        
    }
}